home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 26
/
Cream of the Crop 26.iso
/
program
/
ddj0897.zip
/
DYN401.ZIP
/
examples
/
exam31
/
main.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-09-27
|
2KB
|
105 lines
/*
*
* This source code is CONFIDENTIAL and
* PROPRIETARY to Algorithms Corporation. Unauthorized
* distribution, adaptation or use may
* be subject to civil and criminal penalties.
*
* Copyright (c) 1993 Algorithms Corporation
* 3020 Liberty Hills Drive
* Franklin, TN 37064
*
* ALL RIGHTS RESERVED.
*
*
*
*/
#include "generics.h"
static object (*old_gPrint)(object, object);
static object new_gPrint(object self, object stream)
{
printf("\n\nxxx\n");
old_gPrint(self, stream);
printf("xxxx\n\n");
}
main(int argc, char *argv[])
{
object myObj;
InitDynace(&argc);
/* Create an instance of the ShortInteger class */
myObj = gNewWithInt(ShortInteger, 6);
/* print it out using the normal gPrint generic */
gPrint(myObj, stdoutStream);
/* save the old generic function in the variable old_gPrint */
old_gPrint = gPrint;
/* make gPrint execute new_gPrint */
gPrint = new_gPrint;
/* execute the new gPrint generic */
gPrint(myObj, stdoutStream);
/* return gPrint to its original generic */
gPrint = old_gPrint;
/* try it out */
gPrint(myObj, stdoutStream);
gDispose(myObj);
return 0;
}
/*
*
* This source code is CONFIDENTIAL and
* PROPRIETARY to Algorithms Corporation. Unauthorized
* distribution, adaptation or use may
* be subject to civil and criminal penalties.
*
* Copyright (c) 1993 Algorithms Corporation
* 3020 Liberty Hills Drive
* Franklin, TN 37064
*
* ALL RIGHTS RESERVED.
*
*
*
*/